1
|
|
|
/*! |
2
|
|
|
|
3
|
|
|
========================================================= |
4
|
|
|
* Paper Dashboard 2 - v2.0.0 |
5
|
|
|
========================================================= |
6
|
|
|
|
7
|
|
|
* Product Page: https://www.creative-tim.com/product/paper-dashboard-2 |
8
|
|
|
* Copyright 2018 Creative Tim (http://www.creative-tim.com) |
9
|
|
|
|
10
|
|
|
* Designed by www.invisionapp.com Coded by www.creative-tim.com |
11
|
|
|
|
12
|
|
|
========================================================= |
13
|
|
|
|
14
|
|
|
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. |
15
|
|
|
|
16
|
|
|
*/ |
17
|
|
|
|
18
|
|
|
(function() { |
19
|
|
|
isWindows = navigator.platform.indexOf('Win') > -1 ? true : false; |
|
|
|
|
20
|
|
|
|
21
|
|
|
if (isWindows) { |
22
|
|
|
// if we are on windows OS we activate the perfectScrollbar function |
23
|
|
|
$('.sidebar .sidebar-wrapper, .main-panel').perfectScrollbar(); |
24
|
|
|
|
25
|
|
|
$('html').addClass('perfect-scrollbar-on'); |
26
|
|
|
} else { |
27
|
|
|
$('html').addClass('perfect-scrollbar-off'); |
28
|
|
|
} |
29
|
|
|
})(); |
30
|
|
|
|
31
|
|
|
transparent = true; |
|
|
|
|
32
|
|
|
transparentDemo = true; |
|
|
|
|
33
|
|
|
fixedTop = false; |
|
|
|
|
34
|
|
|
|
35
|
|
|
navbar_initialized = false; |
|
|
|
|
36
|
|
|
backgroundOrange = false; |
|
|
|
|
37
|
|
|
sidebar_mini_active = false; |
|
|
|
|
38
|
|
|
toggle_initialized = false; |
|
|
|
|
39
|
|
|
|
40
|
|
|
seq = 0, delays = 80, durations = 500; |
|
|
|
|
41
|
|
|
seq2 = 0, delays2 = 80, durations2 = 500; |
|
|
|
|
42
|
|
|
|
43
|
|
|
$(document).ready(function() { |
44
|
|
|
|
45
|
|
|
if ($('.full-screen-map').length == 0 && $('.bd-docs').length == 0) { |
|
|
|
|
46
|
|
|
// On click navbar-collapse the menu will be white not transparent |
47
|
|
|
$('.collapse').on('show.bs.collapse', function() { |
48
|
|
|
$(this).closest('.navbar').removeClass('navbar-transparent').addClass('bg-white'); |
49
|
|
|
}).on('hide.bs.collapse', function() { |
50
|
|
|
$(this).closest('.navbar').addClass('navbar-transparent').removeClass('bg-white'); |
51
|
|
|
}); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
paperDashboard.initMinimizeSidebar(); |
|
|
|
|
55
|
|
|
|
56
|
|
|
$navbar = $('.navbar[color-on-scroll]'); |
|
|
|
|
57
|
|
|
scroll_distance = $navbar.attr('color-on-scroll') || 500; |
|
|
|
|
58
|
|
|
|
59
|
|
|
// Check if we have the class "navbar-color-on-scroll" then add the function to remove the class "navbar-transparent" so it will transform to a plain color. |
60
|
|
|
if ($('.navbar[color-on-scroll]').length != 0) { |
|
|
|
|
61
|
|
|
paperDashboard.checkScrollForTransparentNavbar(); |
62
|
|
|
$(window).on('scroll', paperDashboard.checkScrollForTransparentNavbar) |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
$('.form-control').on("focus", function() { |
66
|
|
|
$(this).parent('.input-group').addClass("input-group-focus"); |
67
|
|
|
}).on("blur", function() { |
68
|
|
|
$(this).parent(".input-group").removeClass("input-group-focus"); |
69
|
|
|
}); |
70
|
|
|
|
71
|
|
|
// Activate bootstrapSwitch |
72
|
|
|
$('.bootstrap-switch').each(function() { |
73
|
|
|
$this = $(this); |
|
|
|
|
74
|
|
|
data_on_label = $this.data('on-label') || ''; |
|
|
|
|
75
|
|
|
data_off_label = $this.data('off-label') || ''; |
|
|
|
|
76
|
|
|
|
77
|
|
|
$this.bootstrapSwitch({ |
78
|
|
|
onText: data_on_label, |
79
|
|
|
offText: data_off_label |
80
|
|
|
}); |
81
|
|
|
}); |
82
|
|
|
}); |
83
|
|
|
|
84
|
|
|
$(document).on('click', '.navbar-toggle', function() { |
85
|
|
|
$toggle = $(this); |
|
|
|
|
86
|
|
|
|
87
|
|
|
if (paperDashboard.misc.navbar_menu_visible == 1) { |
|
|
|
|
88
|
|
|
$('html').removeClass('nav-open'); |
89
|
|
|
paperDashboard.misc.navbar_menu_visible = 0; |
90
|
|
|
setTimeout(function() { |
91
|
|
|
$toggle.removeClass('toggled'); |
92
|
|
|
$('#bodyClick').remove(); |
93
|
|
|
}, 550); |
94
|
|
|
|
95
|
|
|
} else { |
96
|
|
|
setTimeout(function() { |
97
|
|
|
$toggle.addClass('toggled'); |
98
|
|
|
}, 580); |
99
|
|
|
|
100
|
|
|
div = '<div id="bodyClick"></div>'; |
|
|
|
|
101
|
|
|
$(div).appendTo('body').click(function() { |
102
|
|
|
$('html').removeClass('nav-open'); |
103
|
|
|
paperDashboard.misc.navbar_menu_visible = 0; |
|
|
|
|
104
|
|
|
setTimeout(function() { |
105
|
|
|
$toggle.removeClass('toggled'); |
106
|
|
|
$('#bodyClick').remove(); |
107
|
|
|
}, 550); |
108
|
|
|
}); |
109
|
|
|
|
110
|
|
|
$('html').addClass('nav-open'); |
111
|
|
|
paperDashboard.misc.navbar_menu_visible = 1; |
112
|
|
|
} |
113
|
|
|
}); |
114
|
|
|
|
115
|
|
|
$(window).resize(function() { |
116
|
|
|
// reset the seq for charts drawing animations |
117
|
|
|
seq = seq2 = 0; |
|
|
|
|
118
|
|
|
|
119
|
|
|
if ($('.full-screen-map').length == 0 && $('.bd-docs').length == 0) { |
|
|
|
|
120
|
|
|
$navbar = $('.navbar'); |
|
|
|
|
121
|
|
|
isExpanded = $('.navbar').find('[data-toggle="collapse"]').attr("aria-expanded"); |
|
|
|
|
122
|
|
|
if ($navbar.hasClass('bg-white') && $(window).width() > 991) { |
123
|
|
|
$navbar.removeClass('bg-white').addClass('navbar-transparent'); |
124
|
|
|
} else if ($navbar.hasClass('navbar-transparent') && $(window).width() < 991 && isExpanded != "false") { |
125
|
|
|
$navbar.addClass('bg-white').removeClass('navbar-transparent'); |
126
|
|
|
} |
127
|
|
|
} |
128
|
|
|
}); |
129
|
|
|
|
130
|
|
|
paperDashboard = { |
|
|
|
|
131
|
|
|
misc: { |
132
|
|
|
navbar_menu_visible: 0 |
133
|
|
|
}, |
134
|
|
|
|
135
|
|
|
initMinimizeSidebar: function() { |
136
|
|
|
if ($('.sidebar-mini').length != 0) { |
|
|
|
|
137
|
|
|
sidebar_mini_active = true; |
|
|
|
|
138
|
|
|
} |
139
|
|
|
|
140
|
|
|
$('#minimizeSidebar').click(function() { |
141
|
|
|
var $btn = $(this); |
|
|
|
|
142
|
|
|
|
143
|
|
|
if (sidebar_mini_active == true) { |
|
|
|
|
144
|
|
|
$('body').addClass('sidebar-mini'); |
145
|
|
|
sidebar_mini_active = true; |
|
|
|
|
146
|
|
|
paperDashboard.showSidebarMessage('Sidebar mini activated...'); |
|
|
|
|
147
|
|
|
} else { |
148
|
|
|
$('body').removeClass('sidebar-mini'); |
149
|
|
|
sidebar_mini_active = false; |
150
|
|
|
paperDashboard.showSidebarMessage('Sidebar mini deactivated...'); |
151
|
|
|
} |
152
|
|
|
|
153
|
|
|
// we simulate the window Resize so the charts will get updated in realtime. |
154
|
|
|
var simulateWindowResize = setInterval(function() { |
155
|
|
|
window.dispatchEvent(new Event('resize')); |
|
|
|
|
156
|
|
|
}, 180); |
157
|
|
|
|
158
|
|
|
// we stop the simulation of Window Resize after the animations are completed |
159
|
|
|
setTimeout(function() { |
160
|
|
|
clearInterval(simulateWindowResize); |
161
|
|
|
}, 1000); |
162
|
|
|
}); |
163
|
|
|
}, |
164
|
|
|
|
165
|
|
|
showSidebarMessage: function(message) { |
166
|
|
|
try { |
167
|
|
|
$.notify({ |
168
|
|
|
icon: "now-ui-icons ui-1_bell-53", |
169
|
|
|
message: message |
170
|
|
|
}, { |
171
|
|
|
type: 'info', |
172
|
|
|
timer: 4000, |
173
|
|
|
placement: { |
174
|
|
|
from: 'top', |
175
|
|
|
align: 'right' |
176
|
|
|
} |
177
|
|
|
}); |
178
|
|
|
} catch (e) { |
179
|
|
|
console.log('Notify library is missing, please make sure you have the notifications library added.'); |
|
|
|
|
180
|
|
|
} |
181
|
|
|
|
182
|
|
|
} |
183
|
|
|
|
184
|
|
|
}; |
185
|
|
|
|
186
|
|
|
function hexToRGB(hex, alpha) { |
187
|
|
|
var r = parseInt(hex.slice(1, 3), 16), |
188
|
|
|
g = parseInt(hex.slice(3, 5), 16), |
189
|
|
|
b = parseInt(hex.slice(5, 7), 16); |
190
|
|
|
|
191
|
|
|
if (alpha) { |
192
|
|
|
return "rgba(" + r + ", " + g + ", " + b + ", " + alpha + ")"; |
193
|
|
|
} else { |
|
|
|
|
194
|
|
|
return "rgb(" + r + ", " + g + ", " + b + ")"; |
195
|
|
|
} |
196
|
|
|
} |
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.
To learn more about declaring variables in Javascript, see the MDN.